let oldHtml;
async function fetchHtml() {
    return await fetch(`/index.html?timestamp=${+new Date()}`)
        .then(res => res.text())
}
async function needUpdate() {
    const newHtml = await fetchHtml()
    let result = false
    if (oldHtml && oldHtml !== newHtml) {
        result = true
    }
    oldHtml = newHtml
    return result
}
function autoRefresh() {
    setTimeout(async () => {
        if (await needUpdate()) {
            const res = confirm('有新版本，点击确定更新')
            if (res) {
                location.reload()
            }
        }
        autoRefresh()
    },10*1000)
}
 // autoRefresh()
